<?php

if (!defined("PATH_HD"))
    exit('No direct script access allowed');
// .-----------------------------------------------------------------------------------
// |  Software: [HDPHP framework]
// |   Version: 2013.01
// |      Site: http://www.hdphp.com
// |-----------------------------------------------------------------------------------
// |    Author: 向军 <houdunwangxj@gmail.com>
// | Copyright (c) 2012-2013, http://houdunwang.com. All Rights Reserved.
// |-----------------------------------------------------------------------------------
// |   License: http://www.apache.org/licenses/LICENSE-2.0
// '-----------------------------------------------------------------------------------
/**
 * HDPHP框架顶级抽象基类
 * @package     core
 * @author      后盾向军 <houdunwangxj@gmail.com>
 */
abstract class HDPHP {

    function __construct() {
        if (method_exists($this, '__init')) {
            $this->__init();
        }
    }

    //魔术方法__get
    public function __get($var) {
        return isset($this->$var) ? $this->$var : NULL;
    }

    //魔术方法__set
    public function __set($var, $value) {
        if (property_exists($this, $var)) {
            return $this->$var = $value;
        }
        return false;
    }

    //魔术方法__call
    public function __call($method, $args) {
        if (method_exists($this, $method)) {
            return call_user_func_array(array($this, $method), $args);
//            return $this->$method($args);// GC
        }
        return false;
    }

}